home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Manage a nightly mirror run.
- # Most of the dirty work is done via mm. This
- # really just handles the logs and mails them out.
-
- # Where mirror and mm are to be found
- home=/src.doc.ic.ac.uk/public/ic.doc/mirror
-
- # Who and how to mail stuff back
- mailto=lmjm
- mail=mail
- mailargs="-s 'nightly mirror log'"
-
- # Arguemnt to pass to sort to get it to show the biggest files
- # in a directory listing.
- #BSD usually +3n, System 5 usually +4n.
- biggest=+3n
-
- # You shouldn't have to change anything below here.
-
- # Log output here.
- log=mirror.nightly.out
-
- cd $home
-
- if [ -r $log ]; then
- # Keep one days backups of the old logs
- mv -f $log $log.old
- fi
-
- # Run mirror master
- # It will output all the pagage log info' into files in
- # the logs/ directory.
- rm -f $log
- if test ! -d logs; then mkdir logs; fi
- ./mm -debug mmin >$log 2>&1 < /dev/null
-
- # Send me the "interesting" bits of the logs
- # The old, new and big stuff
- logs_ls=/tmp/logs-ls
- ls -ltr logs > $logs_ls
- (
- echo Unlinks needed on:
- grep -l "^NEED" logs/*
- echo Old:
- head $logs_ls
- echo
- echo Recent:
- tail $logs_ls
- echo
- echo Bigest:
- sort $biggest < $logs_ls | tail
- echo
- echo Those logs in full:
- cat -s logs/*
- ) | eval $mail $mailargs $mailto
- rm -f $logs_ls
-